<%@LANGUAGE="VBSCRIPT"%>
 
<!--#include file="functions.asp" -->
<% 

set cn=Server.CreateObject("ADODB.Connection")
cn.Open "MP2ENTPONSL", "MP2", "MP2"
dim sql

   dim tmpSQL
   if (request.querystring("InvStatus") <> "0") then
   tmpSQL=" AND INVSTATUS='"& request.querystring("InvStatus") & "'"
   'else
   'tmpSQL=" AND (INVSTATUS = 'PARKED' OR INVSTATUS = 'ROUTED' OR INVSTATUS = 'PREAPPROVED' OR INVSTATUS = 'APPROVED')"
   end if
   
   if (request.querystring("CurSymbol") <> "N") then
   tmpSQL= tmpSQL & " AND CURRENCYSYMBOL='"& request.querystring("CurSymbol") & "'"
   end if
   
   
   if (request.querystring("Location") <> "") then
   tmpSQL= tmpSQL & " AND LOCATION='"& request.querystring("location") & "'"
   end if
   
   if (request.querystring("UserCoord") <> "") then
   tmpSQL= tmpSQL & " AND USERCOORD='"& request.querystring("UserCoord") & "'"
   end if
   
   if (request.querystring("VendorID") <> "") then
   tmpSQL= tmpSQL & " AND VENDORID='"& request.querystring("VendorID") & "'"
   end if
   
   if (request.querystring("RefOrder") <> "0") then
   tmpSQL= tmpSQL & " AND REFORDER='"& request.querystring("RefOrder") & "'"
   end if
   
   dim tmpSort
   tmpSort="INVRECDATE"
   if (request.querystring("dSort") <> "") then
   tmpSort= request.querystring("dSort")
   end if
   
   dim tmpOrder
   tmpOrder = "ASC"
   if (request.QueryString("dOrder") <>"") then
   tmpOrder= request.QueryString("dOrder")
   end if
   Dim CurrOrder
   if (tmpOrder = "ASC" )then 
   CurrOrder ="DESC"
   else
   CurrOrder="ASC"
   end if
%>
<%
set CompCode = Server.CreateObject("ADODB.Recordset")
CompCode.ActiveConnection = cn
CompCode.Source = "SELECT *  FROM dbo.COMPCODE"
'CompCode.CursorType = 0
'CompCode.CursorLocation = 2
'CompCode.LockType = 3
CompCode.Open()
CompCode_numRows = 0
%>
<%
Dim EXIREG__tmpNum
EXIREG__tmpNum = "0"
if (Request.QueryString("Seqnum") <> "") then EXIREG__tmpNum = Request.QueryString("Seqnum")
%>
<%
set EXIREG = Server.CreateObject("ADODB.Recordset")
EXIREG.ActiveConnection = cn
if (request.querystring("Seqnum") <> "0") then
EXIREG.Source = "SELECT SEQNUM, REGNUM, INVNUM, INVSTATUS, VENDORID, PONUM,INVRECDATE, INVDUEDATE, EMPCODE, LOCATION, DEPARTMENT, "_
& "INVCURRENCY, (SELECT EXCHANGERATE FROM EXCHRATE WHERE EXCHRATE.MP2CURRENCY=EXIREG.INVCURRENCY) AS FRATE,REFERENCEDOC,"_
& "VERIFIEDBY, VERIFIEDSTATUS, AUTHORISEDBY, APPROVEDBY,APPROVED2BY,JOINAPPROVAL,"_
& "DATEVERIFIED,DATEAUTHORISED,DATEAPPROVED,DATEAPPROVED2,MULTIVERIFY,"_
& "CURRENCYSYMBOL, INVAMOUNT, REFORDER, DOC1, DOC2, COMPCODE, VATNUM, WHTNAME, VATRATE, (SELECT EMP.FIRSTNAME + ' '  + EMP.LASTNAME FROM dbo.EMP WHERE EMP.EMPCODE=EXIREG.LOCATION) AS LOCNAME,"_
& "WHTRATE, WHTAMOUNT, VATPAIDTOVENDOR,   (SELECT TOP 1 VENDOR.NAME  FROM VENDOR  WHERE VENDOR.VENDORID=EXIREG.VENDORID) AS VENDORNAME,    "_
& "(SELECT EMP.FIRSTNAME + ' '  + EMP.LASTNAME FROM dbo.EMP WHERE EMP.EMPCODE=EXIREG.EMPCODE) AS EMPNAME,  "_
& "(SELECT EMP.FIRSTNAME + ' '  + EMP.LASTNAME FROM dbo.EMP WHERE EMP.EMPCODE=EXIREG.VERIFIEDBY) AS VERNAME,"_
& "(SELECT EMP.FIRSTNAME + ' '  + EMP.LASTNAME FROM dbo.EMP WHERE EMP.EMPCODE=EXIREG.AUTHORISEDBY) AS AUTHNAME,"_
& "(SELECT EMP.FIRSTNAME + ' '  + EMP.LASTNAME FROM dbo.EMP WHERE EMP.EMPCODE=EXIREG.APPROVEDBY) AS APPRNAME,"_
& "(SELECT EMP.FIRSTNAME + ' '  + EMP.LASTNAME FROM dbo.EMP WHERE EMP.EMPCODE=EXIREG.APPROVED2BY) AS APPRNAME2,"_
& "COMMENTS  FROM dbo.EXIREG  WHERE  SEQNUM=" + Replace(EXIREG__tmpNum, "'", "''") + " " 
else
EXIREG.Source = "SELECT SEQNUM, REGNUM, INVSTATUS,INVNUM, LOCATION,VENDORID, PONUM,INVRECDATE, INVDUEDATE, REFERENCEDOC,"_
& "EMPCODE, DEPARTMENT, INVCURRENCY, (SELECT EMP.FIRSTNAME + ' '  + EMP.LASTNAME FROM dbo.EMP WHERE EMP.EMPCODE=EXIREG.LOCATION) AS LOCNAME,"_
& "(SELECT EXCHANGERATE FROM EXCHRATE WHERE EXCHRATE.MP2CURRENCY=EXIREG.INVCURRENCY) AS FRATE, CURRENCYSYMBOL, "_
& "VERIFIEDBY, VERIFIEDSTATUS, AUTHORISEDBY, APPROVEDBY,APPROVED2BY,JOINAPPROVAL,"_
& "DATEVERIFIED,DATEAUTHORISED,DATEAPPROVED,DATEAPPROVED2,MULTIVERIFY,"_
& "INVAMOUNT, REFORDER, DOC1, DOC2, COMPCODE, VATNUM, WHTNAME, VATRATE, WHTRATE, WHTAMOUNT, VATPAIDTOVENDOR, "_
& "(SELECT TOP 1 VENDOR.NAME  FROM VENDOR  WHERE VENDOR.VENDORID=EXIREG.VENDORID) AS VENDORNAME,  "_
& "(SELECT EMP.FIRSTNAME + ' '  + EMP.LASTNAME FROM dbo.EMP WHERE EMP.EMPCODE=EXIREG.EMPCODE) AS EMPNAME, "_
& "(SELECT EMP.FIRSTNAME + ' '  + EMP.LASTNAME FROM dbo.EMP WHERE EMP.EMPCODE=EXIREG.VERIFIEDBY) AS VERNAME,"_
& "(SELECT EMP.FIRSTNAME + ' '  + EMP.LASTNAME FROM dbo.EMP WHERE EMP.EMPCODE=EXIREG.AUTHORISEDBY) AS AUTHNAME,"_
& "(SELECT EMP.FIRSTNAME + ' '  + EMP.LASTNAME FROM dbo.EMP WHERE EMP.EMPCODE=EXIREG.APPROVEDBY) AS APPRNAME,"_
& "(SELECT EMP.FIRSTNAME + ' '  + EMP.LASTNAME FROM dbo.EMP WHERE EMP.EMPCODE=EXIREG.APPROVED2BY) AS APPRNAME2,"_
& "COMMENTS  FROM dbo.EXIREG  WHERE SEQNUM IS NOT NULL " & tmpSQL & " ORDER BY " & tmpSort & " " & tmpOrder
end if
'EXIREG.CursorType = 0
'EXIREG.CursorLocation = 2
'EXIREG.LockType = 3
EXIREG.Open()
EXIREG_numRows = 0
%>
<% 
'Dim InvSeqnum
'InvSeqnum = EXIREG.Fields.Item("SEQNUM").Value
%>
<%
Dim InvHist__tmpNum
InvHist__tmpNum = "0"
if (Request.QueryString("seqnum") <> "") then InvHist__tmpNum = Request.QueryString("seqnum")

%>
<%
set InvHist = Server.CreateObject("ADODB.Recordset")
InvHist.ActiveConnection = cn
'if (request.querystring("Seqnum") <> "0") then
InvHist.Source = "SELECT *,  (SELECT TRDESCR FROM EXITRTYPE WHERE EXIHIST.TRANSTYPE=EXITRTYPE.TRTYPE) AS TRDESCR ,   (SELECT EMP.FIRSTNAME + ' '  + EMP.LASTNAME FROM dbo.EMP WHERE EMP.EMPCODE=EXIHIST.LOCATION) AS LOCNAME  FROM dbo.EXIHIST  WHERE SEQNUM=" + Replace(InvHist__tmpNum, "'", "''") + ""
'else
'InvHist.Source = "SELECT *,  (SELECT TRDESCR FROM EXITRTYPE WHERE EXIHIST.TRANSTYPE=EXITRTYPE.TRTYPE) AS TRDESCR ,   (SELECT EMP.FIRSTNAME + ' '  + EMP.LASTNAME FROM dbo.EMP WHERE EMP.EMPCODE=EXIHIST.LOCATION) AS LOCNAME  FROM dbo.EXIHIST  WHERE SEQNUM=" + Replace(InvSeqnum, "'", "''") + ""
'end if
'InvHist.CursorType = 0
'InvHist.CursorLocation = 2
'InvHist.LockType = 3
InvHist.Open()
InvHist_numRows = 0
%>
<%
Dim Acct__tmpNum
Acct__tmpNum = "0"
if (request.querystring("seqnum") <> "") then Acct__tmpNum = request.querystring("seqnum")
%>
<%
set Acct = Server.CreateObject("ADODB.Recordset")
Acct.ActiveConnection = cn
Acct.Source = "SELECT *  FROM dbo.EXICHARGE  WHERE INVSEQNUM=" + Replace(Acct__tmpNum, "'", "''") + ""
'Acct.CursorType = 0
'Acct.CursorLocation = 2
'Acct.LockType = 3
Acct.Open()
Acct_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
InvHist_numRows = InvHist_numRows + Repeat1__numRows
%>
<%
Dim Repeat2__numRows
Repeat2__numRows = -1
Dim Repeat2__index
Repeat2__index = 0
Acct_numRows = Acct_numRows + Repeat2__numRows
%>
<%
'  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

' set the record count
EXIREG_total = EXIREG.RecordCount

' set the number of rows displayed on this page
If (EXIREG_numRows < 0) Then
  EXIREG_numRows = EXIREG_total
Elseif (EXIREG_numRows = 0) Then
  EXIREG_numRows = 1
End If

' set the first and last displayed record
EXIREG_first = 1
EXIREG_last  = EXIREG_first + EXIREG_numRows - 1

' if we have the correct record count, check the other stats
If (EXIREG_total <> -1) Then
  If (EXIREG_first > EXIREG_total) Then EXIREG_first = EXIREG_total
  If (EXIREG_last > EXIREG_total) Then EXIREG_last = EXIREG_total
  If (EXIREG_numRows > EXIREG_total) Then EXIREG_numRows = EXIREG_total
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them

If (EXIREG_total = -1) Then

  ' count the total records by iterating through the recordset
  EXIREG_total=0
  While (Not EXIREG.EOF)
    EXIREG_total = EXIREG_total + 1
    EXIREG.MoveNext
  Wend

  ' reset the cursor to the beginning
  If (EXIREG.CursorType > 0) Then
    EXIREG.MoveFirst
  Else
    EXIREG.Requery
  End If

  ' set the number of rows displayed on this page
  If (EXIREG_numRows < 0 Or EXIREG_numRows > EXIREG_total) Then
    EXIREG_numRows = EXIREG_total
  End If

  ' set the first and last displayed record
  EXIREG_first = 1
  EXIREG_last = EXIREG_first + EXIREG_numRows - 1
  If (EXIREG_first > EXIREG_total) Then EXIREG_first = EXIREG_total
  If (EXIREG_last > EXIREG_total) Then EXIREG_last = EXIREG_total

End If
%>
<%
' *** Move To Record and Go To Record: declare variables

Set MM_rs    = EXIREG
MM_rsCount   = EXIREG_total
MM_size      = EXIREG_numRows
MM_uniqueCol = ""
MM_paramName = ""
MM_offset = 0
MM_atTotal = false
MM_paramIsDefined = false
If (MM_paramName <> "") Then
  MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
End If
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter

if (Not MM_paramIsDefined And MM_rsCount <> 0) then

  ' use index parameter if defined, otherwise use offset parameter
  r = Request.QueryString("index")
  If r = "" Then r = Request.QueryString("offset")
  If r <> "" Then MM_offset = Int(r)

  ' if we have a record count, check if we are past the end of the recordset
  If (MM_rsCount <> -1) Then
    If (MM_offset >= MM_rsCount Or MM_offset = -1) Then  ' past end or move last
      If ((MM_rsCount Mod MM_size) > 0) Then         ' last page not a full repeat region
        MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
      Else
        MM_offset = MM_rsCount - MM_size
      End If
    End If
  End If

  ' move the cursor to the selected record
  i = 0
  While ((Not MM_rs.EOF) And (i < MM_offset Or MM_offset = -1))
    MM_rs.MoveNext
    i = i + 1
  Wend
  If (MM_rs.EOF) Then MM_offset = i  ' set MM_offset to the last possible record

End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range

If (MM_rsCount = -1) Then

  ' walk to the end of the display range for this page
  i = MM_offset
  While (Not MM_rs.EOF And (MM_size < 0 Or i < MM_offset + MM_size))
    MM_rs.MoveNext
    i = i + 1
  Wend

  ' if we walked off the end of the recordset, set MM_rsCount and MM_size
  If (MM_rs.EOF) Then
    MM_rsCount = i
    If (MM_size < 0 Or MM_size > MM_rsCount) Then MM_size = MM_rsCount
  End If

  ' if we walked off the end, set the offset based on page size
  If (MM_rs.EOF And Not MM_paramIsDefined) Then
    If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
      If ((MM_rsCount Mod MM_size) > 0) Then
        MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
      Else
        MM_offset = MM_rsCount - MM_size
      End If
    End If
  End If

  ' reset the cursor to the beginning
  If (MM_rs.CursorType > 0) Then
    MM_rs.MoveFirst
  Else
    MM_rs.Requery
  End If

  ' move the cursor to the selected record
  i = 0
  While (Not MM_rs.EOF And i < MM_offset)
    MM_rs.MoveNext
    i = i + 1
  Wend
End If
%>
<%
' *** Move To Record: update recordset stats

' set the first and last displayed record
EXIREG_first = MM_offset + 1
EXIREG_last  = MM_offset + MM_size
If (MM_rsCount <> -1) Then
  If (EXIREG_first > MM_rsCount) Then EXIREG_first = MM_rsCount
  If (EXIREG_last > MM_rsCount) Then EXIREG_last = MM_rsCount
End If

' set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then MM_removeList = MM_removeList & "&" & MM_paramName & "="
MM_keepURL="":MM_keepForm="":MM_keepBoth="":MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each Item In Request.QueryString
  NextItem = "&" & Item & "="
  If (InStr(1,MM_removeList,NextItem,1) = 0) Then
    MM_keepURL = MM_keepURL & NextItem & Server.URLencode(Request.QueryString(Item))
  End If
Next

' add the Form variables to the MM_keepForm string
For Each Item In Request.Form
  NextItem = "&" & Item & "="
  If (InStr(1,MM_removeList,NextItem,1) = 0) Then
    MM_keepForm = MM_keepForm & NextItem & Server.URLencode(Request.Form(Item))
  End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
if (MM_keepBoth <> "") Then MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
if (MM_keepURL <> "")  Then MM_keepURL  = Right(MM_keepURL, Len(MM_keepURL) - 1)
if (MM_keepForm <> "") Then MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
  If (firstItem <> "") Then
    MM_joinChar = "&"
  Else
    MM_joinChar = ""
  End If
End Function
%>
<%
' *** Move To Record: set the strings for the first, last, next, and previous links

MM_keepMove = MM_keepBoth
MM_moveParam = "index"

' if the page has a repeated region, remove 'offset' from the maintained parameters
If (MM_size > 0) Then
  MM_moveParam = "offset"
  If (MM_keepMove <> "") Then
    params = Split(MM_keepMove, "&")
    MM_keepMove = ""
    For i = 0 To UBound(params)
      nextItem = Left(params(i), InStr(params(i),"=") - 1)
      If (StrComp(nextItem,MM_moveParam,1) <> 0) Then
        MM_keepMove = MM_keepMove & "&" & params(i)
      End If
    Next
    If (MM_keepMove <> "") Then
      MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
    End If
  End If
End If

' set the strings for the move to links
If (MM_keepMove <> "") Then MM_keepMove = MM_keepMove & "&"
urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove & MM_moveParam & "="
MM_moveFirst = urlStr & "0"
MM_moveLast  = urlStr & "-1"
MM_moveNext  = urlStr & Cstr(MM_offset + MM_size)
prev = MM_offset - MM_size
If (prev < 0) Then prev = 0
MM_movePrev  = urlStr & Cstr(prev)
%>

<%
dim isUser
dim isAuthorised
dim isOutLimit
dim TrType
dim Caption1
dim Caption2
dim Verseqnum
verseqnum=0

Function get_Authorise(e)
'if (EXIREG.Fields.Item("APPROVEDBY").Value <> "") then
 sql = "SELECT  A.GROUPDESC, A.EMPCODE, B.CURRENCY, B.INVAMTPO, B.INVAMTNONPO"
 sql = sql & " FROM dbo.EXIAUTHORITY A, dbo.EXIAUTHFINANCE B"
 sql = sql & " WHERE A.GROUPDESC=B.GROUPDESC "
 sql = sql & " AND A.EMPCODE = '" & e & "'"
 set rs = cn.execute(sql)
 
do while not rs.eof
 if (EXIREG.Fields.Item("REFORDER").Value = "Y") then
   if ((EXIREG.Fields.Item("INVAMOUNT").Value/EXIREG.Fields.Item("FRATE").Value) > rs("INVAMTPO")) then
     get_Authorise = "N"
   else
     get_Authorise = "Y"
   end if
 else
   if ((EXIREG.Fields.Item("INVAMOUNT").Value/EXIREG.Fields.Item("FRATE").Value) > rs("INVAMTNONPO")) then
     get_Authorise = "N"
   else
     get_Authorise = "Y"
   end if
 end if
 
rs.movenext
loop
set rs = nothing
'end if

end function

if (EXIREG.Fields.Item("APPROVEDBY").Value<>"")then
isAuthorised=get_Authorise(EXIREG.Fields.Item("APPROVEDBY").Value)
end if

if (EXIREG.Fields.Item("APPROVED2BY").Value<>"")then
isAuthorised=get_Authorise(EXIREG.Fields.Item("APPROVED2BY").Value)
end if


if(EXIREG.Fields.Item("JOINAPPROVAL").Value="Y") then
  caption1="Approved 1 By:"
  caption2="Approved 2 By:"
else
  caption1="Approved By:"
end if

%>

<SCRIPT Language="JavaScript">

function Valid_Charge(x,y)
{
  var dtTotal=y;
  var totalValue =  Number(document.form1.Amt1.value) + Number(document.form1.Amt2.value)+Number(document.form1.Amt3.value) +Number(document.form1.Amt4.value)+ Number(document.form1.Amt5.value);
   
   if (totalValue > dtTotal ){
     alert("Total amount is greater than invoice amount!");
     x.focus();
	 x.value=0;
     return false;
	 }
}

function DocLoad(){
var joinAppr='<%=(EXIREG.Fields.Item("JOINAPPROVAL").Value)%>';
var isAuthorised='<%= isAuthorised %>';
document.form1.reqInvoiceNo.focus();
if (joinAppr=='N'){
  document.getElementById("Approved2").style.display='none';
  }
if (isAuthorised=='N'){
  document.getElementById("Authorise").style.display='block';
  }
else
  {
  document.getElementById("Authorise").style.display='none';
  }
}


var InvStatus='<%= request.querystring("InvStatus") %>';
var dsort='<%= request.querystring("dsort") %>';
var dorder='<%= request.querystring("dorder") %>';
var Location='<%= request.querystring("Location") %>';
var UserCoord='<%= request.querystring("UserCoord") %>';
var RefOrder='<%= request.querystring("refOrder") %>';
var VendorID='<%= request.querystring("VendorID") %>';
var CurSymbol='<%= request.querystring("CurSymbol") %>';

//function DocLoad(){
//document.form1.reqInvoiceNo.focus();
//}

function redirect(){
location='InvList.asp?InvStatus='+InvStatus+'&dsort='+ dsort+'&dorder='+ dorder+'&Location='+Location+'&UserCoord='+UserCoord+'&RefOrder='+RefOrder+'&VendorID='+VendorID+'&CurSymbol='+CurSymbol;
return false
}

function reroute(a,b){
var Status='<%=(EXIREG.Fields.Item("INVSTATUS").Value)%>';
if (Status=='APPROVED'){
 if (confirm('Invoice already APPROVED. Are You sure you want to reroute this invoice?')==true){
 location='Inv_Routing.asp?route='+a+ '&seqnum='+b+'&InvStatus='+InvStatus+'&dsort='+ dsort+'&dorder='+ dorder+'&Location='+Location+'&UserCoord='+UserCoord+'&RefOrder='+RefOrder+'&VendorID='+VendorID+'&CurSymbol='+CurSymbol;
 return true;
 }
 else
 return false;
}
else
location='Inv_Routing.asp?route='+a+ '&seqnum='+b+'&InvStatus='+InvStatus+'&dsort='+ dsort+'&dorder='+ dorder+'&Location='+Location+'&UserCoord='+UserCoord+'&RefOrder='+RefOrder+'&VendorID='+VendorID+'&CurSymbol='+CurSymbol;
return true
}

function register(){
location='Inv_Register.asp?InvStatus='+InvStatus+'&dsort='+ dsort+'&dorder='+ dorder+'&Location='+Location+'&UserCoord='+UserCoord+'&RefOrder='+RefOrder+'&VendorID='+VendorID+'&CurSymbol='+CurSymbol;
return false
}
</SCRIPT>
<!-- #include file="pagetop.asp" -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td nowrap height="21" bgcolor="#FFFFFF" width="3%" background="images/menu_end.gif">&nbsp;</td>
    <td nowrap height="21" bgcolor="#FFFFFF" width="28"> 
      <div align="center"><img src="images/menu_awal_off.gif" width="28" height="33"></div>
    </td>
    <td width="10%" background="images/menuoff.gif" height="21" nowrap> 
      <div align="center"><b><a href="#" onClick="return redirect()" class="menu">Invoice 
        List</a></b></div>
    </td>
    <td nowrap height="21" width="28"><img src="images/menu_off_on_separator.gif" width="28" height="33"></td>
    <td width="10%" background="images/menuon.gif" height="21" nowrap> 
      <div align="center"><b class="menu">Record View</b></div>
    </td>
    <td width="28" height="21" nowrap><img src="images/menu_on_off_separator.gif" width="28" height="33"></td>
    <td width="10%" background="images/menuoff.gif" height="21" nowrap> 
      <div align="center"><b class="menu"><a href="#" class="menu" onclick="return register()">Invoice 
        Register</a></b></div>
    </td>
    <td height="21" bgcolor="#FFFFFF" width="11"><img src="images/Menu_offend.gif" width="11" height="33"></td>
    <td height="21" bgcolor="#FFFFFF" background="images/menu_end.gif"> 
      <div align="right"></div>
    </td>
  </tr>
  <tr bgcolor="#93bee2"> 
    <td height="21" width="3%" bgcolor="#93bee2">&nbsp;</td>
    <td height="21" width="28" bgcolor="#93bee2">&nbsp;</td>
    <td width="10%" height="21" bgcolor="#93bee2">&nbsp;</td>
    <td height="21" width="28">&nbsp;</td>
    <td width="10%" height="21">&nbsp;</td>
    <td width="28" height="21">&nbsp;</td>
    <td width="10%" height="21">&nbsp;</td>
    <td height="21">&nbsp;</td>
    <td height="21">&nbsp;</td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#93bee2">
  <tr> 
    <td width="4%">&nbsp;</td>
    <td width="2%">&nbsp;</td>
    <td> 
      <table border="0" width="50%" align="left">
        <tr> 
          <td width="23%" align="center"> <b> 
            <% If MM_offset <> 0 Then %>
            <a href="<%=MM_moveFirst%>">&lt;&lt; 
            First</a> 
            <% End If ' end MM_offset <> 0 %>
            </b></td>
          <td width="31%" align="center"> <b> 
            <% If MM_offset <> 0 Then %>
            <a href="<%=MM_movePrev%>">&lt; 
            Previous</a> 
            <% End If ' end MM_offset <> 0 %>
            </b></td>
          <td width="23%" align="center"> <b> 
            <% If Not MM_atTotal Then %>
            <a href="<%=MM_moveNext%>">Next 
            &gt; </a> 
            <% End If ' end Not MM_atTotal %>
            </b></td>
          <td width="23%" align="center"> <b> 
            <% If Not MM_atTotal Then %>
            <a href="<%=MM_moveLast%>">Last 
            &gt;&gt; </a> 
            <% End If ' end Not MM_atTotal %>
            </b></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr> 
    <td width="4%">&nbsp;</td>
    <td width="2%">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr> 
    <td width="4%" height="20">&nbsp;</td>
    <td width="2%" bgcolor="#FFFFFF" height="20"><img src="images/curv_data.gif" width="21" height="21"></td>
    <td bgcolor="#FFFFFF" height="20">&nbsp; Records <%=(EXIREG_first)%> to <%=(EXIREG_last)%> of <%=(EXIREG_total)%> </td>
  </tr>
  <tr> 
    <td width="4%">&nbsp;</td>
    <td width="2%" bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF"> 
      <form name="form1" method="post" action="Inv_Process.asp" onSubmit="return checkrequired(this)">
        <table width="100%" border="0" cellspacing="2" cellpadding="3">
          <tr> 
            <td width="15%" bgcolor="#dedede" height="38"> 
              <div align="right"><b>Register No.:&nbsp;</b></div>
            </td>
            <td width="2%" height="38">&nbsp;</td>
            <td width="30%" height="38"> 
              <input type="text" name="RegNo" size="12" maxlength="12" class="InputBox" value="<%=(EXIREG.Fields.Item("REGNUM").Value)%>" readOnly=true>
              <input type="hidden" name="seqnum2" value="<%=(EXIREG.Fields.Item("SEQNUM").Value)%>">
            </td>
            <td width="15%" bgcolor="#dedede" height="38"> 
              <div align="right"><b>Invoice No.:&nbsp;</b></div>
            </td>
            <td width="2%" height="38">&nbsp;</td>
            <td height="38"> 
              <input type="text" name="reqInvoiceNo" size="25" maxlength="25" class="InputBox" value="<%=(EXIREG.Fields.Item("INVNUM").Value)%>">
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Reference Order:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="checkbox" name="RefOrder" value="Y" <% if (EXIREG.Fields.Item("REFORDER").Value="Y") then response.write "checked" %>>
            </td>
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Current Location:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td bgcolor="#FFFFFF"><b><font color="#990000"> 
              <% if (EXIREG.Fields.Item("LOCATION").Value="FINANCE") then %>
              FINANCE 
              <% else %>
              <%=(EXIREG.Fields.Item("LOCNAME").Value)%> 
              <% end if %>
              </font></b></td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Vendor ID:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="reqVendorID" size="12" maxlength="12" class="InputBox" value="<%=(EXIREG.Fields.Item("VENDORID").Value)%>">
              <input type="button" name="Button22" value=" ... " class="sbttn" onClick="openpopup('VendorList.asp?fName=form1.reqVendorID&fName2=form1.VendorName')" >
            </td>
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Status:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td bgcolor="#FFFFFF"> 
              <input type="text" name="Status" size="15" class="InputBox" readOnly=true value="<%=(EXIREG.Fields.Item("INVSTATUS").Value)%>" >
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Vendor Name:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td colspan="4"> 
              <input type="text" name="VendorName" size="50" class="InputBox" value="<%=(EXIREG.Fields.Item("VENDORNAME").Value)%>">
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Received Date:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="ReceivedDate" size="12" maxlength="12" class="InputBox" value="<%=(EXIREG.Fields.Item("INVRECDATE").Value)%>" onBlur="AddDate(this.value)" onChange="AddDate(this.value)">
              <input type="button" name="Submit5" value=" ... " class="sbttn" onClick="javascript:show_calendar('form1.ReceivedDate');" onBlur="AddDate(document.form1.ReceivedDate.value)">
              <script language="JavaScript">
function AddDate(x)
{
var CurDate=new Date(x);
var ms=CurDate.getTime()+30*86400000;
var newDate=new Date(ms) ;
document.form1.DueDate.value = new String((newDate.getMonth()+1)+'/'+newDate.getDate()+'/'+newDate.getYear());
//document.form1.DueDate.value = String(CurDate);
}
</script>
            </td>
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Due Date:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td> 
              <input type="text" name="DueDate" size="12" maxlength="12" class="InputBox" value="<%=(EXIREG.Fields.Item("INVDUEDATE").Value)%>">
              <input type="button" name="Submit52" value=" ... " class="sbttn" onClick="javascript:show_calendar('form1.DueDate')">
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Received By:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="reqReceivedBy" size="12" maxlength="12" class="InputBox" value="<%=(EXIREG.Fields.Item("EMPCODE").Value)%>">
              <input type="button" name="Button223" value=" ... " class="sbttn" onClick="openpopup('EmpList.asp?fName=form1.reqReceivedBy&fName2=form1.empName&fName3=form1.Dept')" >
            </td>
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Department:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td> 
              <input type="text" name="Dept" size="30" maxlength="30" class="InputBox" value="<%=(EXIREG.Fields.Item("DEPARTMENT").Value)%>">
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede">&nbsp;</td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="empName" size="35" class="InputBox" value="<%=(EXIREG.Fields.Item("EMPNAME").Value)%>">
            </td>
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>PO/SO/CO No:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td> 
              <input type="text" name="reqPONum" value="<%=(EXIREG.Fields.Item("PONUM").Value)%>" class="InputBox">
              <input type="button" name="btnPO" value=" ... " class="sbttn" onClick="openpopup('POList.asp?fName=form1.reqPONum&VendorID=<%=(EXIREG.Fields.Item("VENDORID").Value)%>')" >
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Currency:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="reqCurrency" size="15" maxlength="15" class="InputBox" value="<%=(EXIREG.Fields.Item("INVCURRENCY").Value)%>">
              <input type="button" name="Button222" value=" ... " class="sbttn" onClick="openpopup2('CurencyList.asp?fName=form1.reqCurrency&fName2=form1.exRate&fName3=form1.curSymbol2')" >
              <input type="hidden" name="curSymbol2">
            </td>
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Exchange Rate:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td> 
              <input type="text" name="exRate" size="15" class="InputBox" value="<%=(EXIREG.Fields.Item("FRATE").Value)%>">
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Invoice Amount:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="InvoiceAmount" size="20" maxlength="20" class="NumBox" onBlur="calcWHT(document.form1.WHTRate.value,this.value)" value="<%=(EXIREG.Fields.Item("INVAMOUNT").Value)%>">
            </td>
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>T0 Code:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td> 
              <select name="CompCode" class="drpdwn">
                <%
While (NOT CompCode.EOF)
%>
                <option value="<%=(CompCode.Fields.Item("COMPCODE").Value)%>" <% if (CompCode.Fields.Item("COMPCODE").Value =EXIREG.Fields.Item("COMPCODE").Value) then response.write "selected" %>><%=(CompCode.Fields.Item("COMPCODE").Value)%> - <%=(CompCode.Fields.Item("COMPCODEDESC").Value)%></option>
                <%
  CompCode.MoveNext()
Wend
If (CompCode.CursorType > 0) Then
  CompCode.MoveFirst
Else
  CompCode.Requery
End If
%>
              </select>
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#FFFFFF"> 
              <div align="right"><b></b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="checkbox" name="cbVAT" value="Y" <% if (EXIREG.Fields.Item("VATPAIDTOVENDOR").Value="Y") then response.write "checked" %>>
              VAT Paid To Vendor</td>
            <td width="15%"> 
              <div align="right"></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td><b></b></td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>WHT Name:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="WHTName" size="15" maxlength="15" class="InputBox" value="<%=(EXIREG.Fields.Item("WHTNAME").Value)%>">
              <input type="button" name="Button2232" value=" ... " class="sbttn" onClick="openpopup('WHTList.asp?fName=form1.WHTName&fName2=form1.WHTRate')" onBlur="calcWHT(document.form1.WHTRate.value,document.form1.InvAmt.value)">
            </td>
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b><b>WHT Rate:</b></b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td> 
              <input type="text" name="WHTRate" size="6" maxlength="6" class="NumBox" onBlur="calcWHT(this.value,document.form1.InvoiceAmount.value)" value="<%=(EXIREG.Fields.Item("WHTRATE").Value)%>">
              <script language="JavaScript">
function calcWHT(x,y){
  var WHTRate = Number(x);
  var InvAmt = Number(y);
  var WHTAmt = 0;
  WHTAmt = InvAmt * WHTRate/100;
  document.form1.WHTAmt.value=String(WHTAmt);
}
</script>
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>VAT Rate:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="VATRate" class="NumBox" size="6" maxlength="6" value="<%=(EXIREG.Fields.Item("VATRATE").Value)%>">
            </td>
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>WHT Amount:</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td> 
              <input type="text" name="WHTAmt" size="15" maxlength="15" class="NumBox" value="<%=(EXIREG.Fields.Item("WHTAMOUNT").Value)%>">
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#FFFFFF" height="23">&nbsp;</td>
            <td width="2%" height="23">&nbsp;</td>
            <td width="30%" height="23"> 
              <input type="checkbox" name="cbOri" value="Y" <% if (EXIREG.Fields.Item("DOC1").Value="Y") then response.write "checked" %>>
              Original Invoice with Revenue Stamp</td>
            <td width="15%" bgcolor="#FFFFFF" height="23">&nbsp;</td>
            <td width="2%" height="23">&nbsp;</td>
            <td height="23"> 
              <input type="checkbox" name="cbTax" value="Y" <% if (EXIREG.Fields.Item("DOC2").Value="Y") then response.write "checked" %>>
              Tax Invoices (6 pages)</td>
          </tr>
          <tr valign="middle"> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Verified By:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td colspan="4"> <%=(EXIREG.Fields.Item("VERIFIEDBY").Value)%> &nbsp;&nbsp; <%=(EXIREG.Fields.Item("VERNAME").Value)%> &nbsp;&nbsp;&nbsp; 
              <% if (EXIREG.Fields.Item("VERIFIEDSTATUS").Value="VERIFIED") then %>
              <img src="images/check.jpg" width="18" height="17">&nbsp;Verified 
              <% end if %>
            </td>
          </tr>
          <tr valign="middle"> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right" id="caption1"><b><%= caption1 %>&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td colspan="4"> <%=(EXIREG.Fields.Item("APPROVEDBY").Value)%> &nbsp;&nbsp; <%=(EXIREG.Fields.Item("APPRNAME").Value)%> &nbsp;&nbsp;&nbsp; 
              <% if (EXIREG.Fields.Item("DATEAPPROVED").Value<>"") then %>
              <img src="images/check.jpg" width="18" height="17">&nbsp;Approved 
              <% end if %>
            </td>
          </tr>
          <tr valign="middle" id="Approved2"> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right" id="caption2"><b><%= caption2 %>&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td colspan="4"> <%=(EXIREG.Fields.Item("APPROVED2BY").Value)%> &nbsp;&nbsp; <%=(EXIREG.Fields.Item("APPRNAME2").Value)%> &nbsp;&nbsp;&nbsp; 
              <% if (EXIREG.Fields.Item("DATEAPPROVED2").Value<>"") then %>
              <img src="images/check.jpg" width="18" height="17">&nbsp;Approved 
              <% end if %>
            </td>
          </tr>
          <tr valign="middle" id="Authorise"> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Authorised By:</b>&nbsp;</div>
            </td>
            <td width="2%">&nbsp;</td>
            <td colspan="4"> <%=(EXIREG.Fields.Item("AUTHORISEDBY").Value)%> &nbsp;&nbsp; <%=(EXIREG.Fields.Item("AUTHNAME").Value)%> &nbsp;&nbsp;&nbsp; 
              <% if (EXIREG.Fields.Item("DATEAUTHORISED").Value<>"") then %>
              <img src="images/check.jpg" width="18" height="17">&nbsp;Authorised 
              <% end if %>
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="30"> 
              <div align="right"><b>Comments:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td colspan="4"> 
              <textarea name="Comments" cols="60" rows="6" class="InputBox"><%=(EXIREG.Fields.Item("COMMENTS").Value)%></textarea>
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#FFFFFF">&nbsp;</td>
            <td width="2%">&nbsp;</td>
            <td colspan="4">&nbsp;</td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#FFFFFF">&nbsp;</td>
            <td width="2%">&nbsp;</td>
            <td colspan="4"> 
              <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#999999" id="Acct_tbl">
                <tr bgcolor="#FFC58A"> 
                  <td width="5%" height="25"> 
                    <div align="center"><b>No</b></div>
                  </td>
                  <td width="17%" height="25"> 
                    <div align="center"><b>Account Code</b></div>
                  </td>
                  <td width="10%" height="25"> 
                    <div align="center"><b>T0</b></div>
                  </td>
                  <td width="15%" height="25" bgcolor="#FFC58A"> 
                    <div align="center"><b>T1</b></div>
                  </td>
                  <td width="12%" height="25"> 
                    <div align="center"><b>T2</b></div>
                  </td>
                  <td width="18%" height="25"> 
                    <div align="center"><b>T3</b></div>
                  </td>
                  <td height="25"> 
                    <div align="center"><b>Amount (<%=(EXIREG.Fields.Item("CURRENCYSYMBOL").Value)%>)</b></div>
                  </td>
                </tr>
                <% dim Incr 
				Incr = 1 %>
                <% 
While ((Repeat2__numRows <> 0) AND (NOT Acct.EOF)) 
%>
                <tr> 
                  <td width="5%" bgcolor="#FFFFFF"> 
                    <div align="center"><%= Incr %>.</div>
                  </td>
                  <td width="17%" bgcolor="#FFFFFF"> 
                    <div align="center"> 
                      <input type="hidden" name="aseqnum<%= Incr %>" value="<%=(Acct.Fields.Item("SEQNUM").Value)%>">
                      <input type="text" name="ActCode<%= Incr %>" class="InputBox" size="12" value="<%=(Acct.Fields.Item("ACCTCODE").Value)%>">
                      <input type="button" name="Button5<%= Incr %>" value="..." class="sbttn" onClick="openpopup2('AcctList.asp?fName=form1.ActCode<%= Incr %>')">
                    </div>
                  </td>
                  <td width="10%" bgcolor="#FFFFFF"> 
                    <div align="center"> 
                      <select name="T0<%= Incr %>" class="drpdwn">
                        <option selected> </option>
                        <%
While (NOT CompCode.EOF)
%>
                        <option value="<%=(CompCode.Fields.Item("COMPCODE").Value)%>" <% if (Acct.Fields.Item("T0CODE").Value=CompCode.Fields.Item("COMPCODE").Value) then response.write "selected" %> ><%=(CompCode.Fields.Item("COMPCODE").Value)%></option>
                        <%
  CompCode.MoveNext()
Wend
If (CompCode.CursorType > 0) Then
  CompCode.MoveFirst
Else
  CompCode.Requery
End If
%>
                      </select>
                    </div>
                  </td>
                  <td width="15%" bgcolor="#FFFFFF"> 
                    <div align="center"> 
                      <input type="text" name="T1<%= Incr %>" size="10" class="InputBox" value="<%=(Acct.Fields.Item("T1CODE").Value)%>">
                      <input type="button" name="Button2<%= Incr %>" value="..." class="sbttn" onClick="openpopup2('AFEList.asp?fName=form1.T1<%= Incr %>&fName2=form1.T1<%= Incr %>')">
                    </div>
                  </td>
                  <td width="12%" bgcolor="#FFFFFF"> 
                    <div align="center"> 
                      <input type="text" name="T2<%= Incr %>" size="6" class="InputBox" value="<%=(Acct.Fields.Item("T2CODE").Value)%>">
                      <input type="button" name="Button22<%= Incr %>" value="..." class="sbttn" onClick="openpopup2('ActivityList.asp?fName=form1.T2<%= Incr %>')">
                    </div>
                  </td>
                  <td width="18%" bgcolor="#FFFFFF"> 
                    <div align="center"> 
                      <input type="text" name="T3<%= Incr %>" size="12" class="InputBox" value="<%=(Acct.Fields.Item("T3CODE").Value)%>">
                      <input type="button" name="Button222<%= Incr %>" value="..." class="sbttn" onClick="openpopup2('T3List.asp?fName=form1.T3<%= Incr %>')">
                    </div>
                  </td>
                  <td bgcolor="#FFFFFF"> 
                    <div align="center"> 
                      <input type="text" name="Amt<%= Incr %>" size="20" class="NumBox" value="<%=(Acct.Fields.Item("AMOUNT").Value)%>" onBlur="Valid_Charge(this,<%= EXIREG.Fields.Item("INVAMOUNT").Value %>)">
                    </div>
                  </td>
                </tr>
                <% Incr = Incr + 1
  Repeat2__index=Repeat2__index+1
  Repeat2__numRows=Repeat2__numRows-1
  Acct.MoveNext()
Wend
%>
                <% if (Incr < 5) then 
   do until incr > 5 %>
                <tr> 
                  <td width="5%" bgcolor="#FFFFFF"> 
                    <div align="center"><%= Incr %>.</div>
                  </td>
                  <td width="17%" bgcolor="#FFFFFF"> 
                    <div align="center"> 
                      <input type="hidden" name="aseqnum<%= Incr %>" value="0">
                      <input type="text" name="ActCode<%= Incr %>" class="InputBox" size="12">
                      <input type="button" name="Button1<%= Incr %>" value="..." class="sbttn" onClick="openpopup2('AcctList.asp?fName=form1.ActCode<%= Incr %>')">
                    </div>
                  </td>
                  <td width="10%" bgcolor="#FFFFFF"> 
                    <div align="center"> 
                      <select name="T0<%= Incr %>" class="drpdwn">
                        <option selected> </option>
                        <%
While (NOT CompCode.EOF)
%>
                        <option value="<%=(CompCode.Fields.Item("COMPCODE").Value)%>" ><%=(CompCode.Fields.Item("COMPCODE").Value)%></option>
                        <%
  CompCode.MoveNext()
Wend
If (CompCode.CursorType > 0) Then
  CompCode.MoveFirst
Else
  CompCode.Requery
End If
%>
                      </select>
                    </div>
                  </td>
                  <td width="15%" bgcolor="#FFFFFF"> 
                    <div align="center"> 
                      <input type="text" name="T1<%= Incr %>" size="10" class="InputBox">
                      <input type="button" name="Button2<%= Incr %>" value="..." class="sbttn" onClick="openpopup2('AFEList.asp?fName=form1.T1<%= Incr %>&fName2=form1.T1<%= Incr %>')">
                    </div>
                  </td>
                  <td width="12%" bgcolor="#FFFFFF"> 
                    <div align="center"> 
                      <input type="text" name="T2<%= Incr %>" size="6" class="InputBox">
                      <input type="button" name="Button2<%= Incr %>" value="..." class="sbttn" onClick="openpopup2('ActivityList.asp?fName=form1.T2<%= Incr %>')">
                    </div>
                  </td>
                  <td width="18%" bgcolor="#FFFFFF"> 
                    <div align="center"> 
                      <input type="text" name="T3<%= Incr %>" size="12" class="InputBox">
                      <input type="button" name="Button22<%= Incr %>" value="..." class="sbttn" onClick="openpopup2('T3List.asp?fName=form1.T3<%= Incr %>')">
                    </div>
                  </td>
                  <td bgcolor="#FFFFFF"> 
                    <div align="center"> 
                      <input type="text" name="Amt<%= Incr %>" size="20" class="NumBox" value="0" onBlur="Valid_Charge(this,<%= EXIREG.Fields.Item("INVAMOUNT").Value %>)">
                    </div>
                  </td>
                </tr>
                <% Incr = Incr + 1
				Loop 
				end if %>
              </table>
              <br>
              <input type="hidden" name="Incr" value="<%= Incr %>">
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#FFFFFF">&nbsp;</td>
            <td width="2%">&nbsp;</td>
            <td width="30%">&nbsp;</td>
            <td width="15%" bgcolor="#FFFFFF">&nbsp;</td>
            <td width="2%">&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr valign="middle"> 
            <td width="15%">&nbsp;</td>
            <td width="2%">&nbsp;</td>
            <td colspan="4"> 
              <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#999999">
                <tr bgcolor="#D1DDEF"> 
                  <td width="6%"> 
                    <div align="center"><b>No.</b></div>
                  </td>
                  <td width="12%"> 
                    <div align="center"><b>Date</b></div>
                  </td>
                  <td> 
                    <div align="center"><b>Description</b></div>
                  </td>
                  <td width="15%"> 
                    <div align="center"><b>Department</b></div>
                  </td>
                  <td width="15%"> 
                    <div align="center"><b>Update By</b></div>
                  </td>
                </tr>
                <%  
				 Incr = 1 %>
                <% 
While ((Repeat1__numRows <> 0) AND (NOT InvHist.EOF)) 
%>
                <tr bgcolor="#FFFFFF"> 
                  <td width="6%"> 
                    <div align="center"><%= Incr %></div>
                  </td>
                  <td width="12%"> 
                    <div align="center"><%= DoDateTime((InvHist.Fields.Item("UPDATESTAMP").Value), 2, 2070) %></div>
                  </td>
                  <td><%=(InvHist.Fields.Item("TRDESCR").Value)%>&nbsp;<%=(InvHist.Fields.Item("LOCNAME").Value)%></td>
                  <td width="15%"><%=(InvHist.Fields.Item("DEPARTMENT").Value)%></td>
                  <td width="15%"><%=(InvHist.Fields.Item("UPDATEUSER").Value)%></td>
                </tr>
                <% Incr = Incr + 1
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  InvHist.MoveNext()
Wend
%>
              </table>
            </td>
          </tr>
          <tr valign="middle"> 
            <td width="15%">&nbsp;</td>
            <td width="2%">&nbsp;</td>
            <td colspan="4"> 
              <input type="hidden" name="Location" value="<%= request.querystring("Location") %>">
              <input type="hidden" name="InvStatus" value="<%= request.querystring("InvStatus") %>">
              <input type="hidden" name="UserCoord" value="<%= request.querystring("UserCoord") %>">
              <input type="hidden" name="RefOrder2" value="<%= request.querystring("RefOrder") %>">
              <input type="hidden" name="VendorID" value="<%= request.querystring("VendorID") %>">
              <input type="hidden" name="CurSymbol" value="<%= request.querystring("CurSymbol") %>">
              <input type="hidden" name="dsort" value="<%= Request.querystring("dsort") %>">
              <input type="hidden" name="dorder" value="<%= Request.querystring("dorder") %>">
            </td>
          </tr>
          <tr valign="middle"> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Action:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td colspan="4"> 
              <input type="submit" name="Submit" value=" Save Changes " class="sbttn">
            </td>
          </tr>
          
        </table>
      </form>
    </td>
  </tr>
  <tr> 
    <td width="4%">&nbsp;</td>
    <td width="2%" bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF">&nbsp;</td>
  </tr>
</table>
</body>
</html>
<%
CompCode.Close()
%>
<%
EXIREG.Close()
%>
<%
InvHist.Close()
%>
<%
Acct.Close()
%>
